package com.usian.feign;

import com.usian.pojo.TbContent;
import com.usian.pojo.TbContentCategory;
import com.usian.utils.AdNode;
import com.usian.utils.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author chen
 * @date 2021/1/11 - 17:03 - 星期一
 * @project usian_parent
 * @package com.usian.feign
 * @by GGbomd猪猪侠
 */
@Component
@FeignClient(value = "usian-content-service")
public interface ContentServiceFeign {
    /**
     * 根据父节点查询子节点
     * @param id
     * @return
     */
    @RequestMapping("/selectContentCategoryByParentId")
    List<TbContentCategory> selectContentCategoryByParentId(@RequestParam Long id);

    /**
     * 内容分类添加操作 tb_content_category
     * @param tbContentCategory
     * @return
     */
    @RequestMapping("/insertContentCategory")
    Integer insertContentCategory(@RequestBody TbContentCategory tbContentCategory);

    /**
     * 删除内容分类
     * @param categoryId
     * @return
     */
    @RequestMapping("/deleteContentCategoryById")
    Integer deleteContentCategoryById(@RequestParam("categoryId") Long categoryId);

    /**
     * 修改内容分类
     * @param id
     * @param name
     * @return
     */
    @RequestMapping("/updateContentCategory")
    Integer updateContentCategory(@RequestParam("id") Long id , @RequestParam("name") String name);

    /**
     * 根据分类查询内容
     * @param page 当前页
     * @param rows 每页显示几条数据
     * @param categoryId 分类的id
     * @return
     */
    @RequestMapping("/selectTbContentAllByCategoryId")
    PageResult selectTbContentAllByCategoryId(@RequestParam Integer page, @RequestParam Integer rows,
                                                     @RequestParam Long categoryId);

    /**
     * 根据分类添加内容
     * @param tbContent
     * @return
     */
    @RequestMapping("/insertTbContent")
    Integer insertTbContent(@RequestBody TbContent tbContent);

    /**
     *  删除分类下的内容
     * @param ids
     * @return
     */
    @RequestMapping("/deleteContentByIds")
    Integer deleteContentByIds(@RequestParam Long ids);

    /**
     * 查询首页大广告位
     * 操作 tb_content
     * @return
     */
    @RequestMapping("/selectFrontendContentByAD")
    List<AdNode> selectFrontendContentByAD();
}
